<template>
  <div id="app">
    <!-- <div style="height:56px"></div>
    <van-nav-bar fixed nav-bar-icon-color="white" :right-text="rightText" @click-left="onClickLeft" @click-right="onClickRight"  :left-arrow="navText!='首页'&&navText!='登录'" style="font-size:16px" :title="navText" /> -->
    <router-view />
  </div>
</template>
<script>
import Vue from "vue";
import Vuex from "vuex";
import {
  NavBar,
  Button,
  SwipeCell,
  Col,
  Row,
  Field,
  Cell,
  CellGroup,
  List,
  PullRefresh,
  Tab,
  Tabs,
  Uploader,
  Overlay,
  Dialog,
  Notify,
  Rate,
  Icon,
  Badge,
  Popup,
  RadioGroup,
  DropdownMenu,
  DropdownItem,
  Radio,
  Tag,
  Swipe,
  SwipeItem,
  Popover,
} from "vant";

Vue.use(NavBar)
  .use(Button)
  .use(SwipeCell)
  .use(Col)
  .use(Row)
  .use(Field)
  .use(Cell)
  .use(CellGroup)
  .use(List)
  .use(Overlay)
  .use(PullRefresh)
  .use(Tab)
  .use(Tabs)
  .use(Uploader)
  .use(Rate)
  .use(Icon)
  .use(Badge)
  .use(Popup)
  .use(Dialog)
  .use(Notify)
  .use(Vuex)
  .use(Icon)
  .use(Radio)
  .use(RadioGroup)
  .use(DropdownMenu)
  .use(DropdownItem)
  .use(Tag)
  .use(Swipe)
  .use(SwipeItem)
  .use(Popover);
export default {
  name: "App",
  data() {
    return {
      ifIndex: true,
      navText: "",
      rightText: "",
    };
  },
  watch: {
    $route(to, from) {
      if (to.name != this.navText) {
        this.navText = to.name;
        if (to.name == "登录") {
          this.rightText = "注册";
        } else {
          this.rightText = "";
        }
      }
    },
  },
  methods: {
    onClickLeft() {
      window.history.go(-1);
    },
    onClickRight() {
      this.$router.push({
        path: "/register",
      });
    },
  },
  mounted() {},
};
</script>

<style scoped lang="less">
#app {
  font-family: "Avenir", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  box-sizing: border-box;
  word-break: break-all;
  /deep/.van-nav-bar__title {
    line-height: 30px;
  }
  /deep/.van-icon {
    color: white;
  }
  /deep/.van-nav-bar__text {
    color: white;
  }
  // overflow:auto;
  /* overflow-x: hidden; */
  /* margin-top: 60px; */
}
</style>
